[WEB-7776] fix(security): scope FileAsset queries to prevent cross-project IDOR (Cluster F)#9288
[WEB-7776] fix(security): scope FileAsset queries to prevent cross-project IDOR (Cluster F)#9288mguptahub wants to merge 1 commit into
Conversation
…oject IDOR (Cluster F) Multiple asset endpoints were missing project-level scoping on FileAsset queryset filters, allowing authenticated users to access, mark-uploaded, or restore assets belonging to other projects/workspaces. - ProjectBulkAssetEndpoint.post: add project_id= scope to asset filter - EntityAssetEndpoint.get/patch: add project_id=deploy_board.project_id - AssetRestoreEndpoint.post: add project_id=deploy_board.project_id - FileAssetEndpoint (V1): add workspace membership check on get/post/delete - FileAssetViewSet.restore (V1): add workspace membership check - WorkspaceFileAssetEndpoint.post: gate WORKSPACE_LOGO on ADMIN role - DuplicateAssetEndpoint.post: restrict source asset to same workspace Fixes GHSA-r2hw, GHSA-jh4v, GHSA-8688, GHSA-3hrj and related advisories. Co-authored-by: Plane AI <noreply@plane.so>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThree asset-related view files receive authorization hardening: ChangesAsset Endpoint Authorization Hardening
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
Summary
Multiple asset endpoints were missing project-level scoping on
FileAssetqueryset filters, allowing authenticated users to access, mark-uploaded, or restore assets belonging to other projects or workspaces they are not members of.Fixes applied
ProjectBulkAssetEndpoint.postapp/views/asset/v2.pyproject_id=project_idto asset filterEntityAssetEndpoint.getspace/views/asset.pyproject_id=deploy_board.project_idEntityAssetEndpoint.patchspace/views/asset.pyproject_id=deploy_board.project_idAssetRestoreEndpoint.postspace/views/asset.pyproject_id=deploy_board.project_idFileAssetEndpointV1 (get/post/delete)app/views/asset/base.pyWorkspaceMembermembership checkFileAssetViewSet.restoreV1app/views/asset/base.pyWorkspaceMembermembership checkWorkspaceFileAssetEndpoint.postapp/views/asset/v2.pyWORKSPACE_LOGOupload onROLE.ADMINDuplicateAssetEndpoint.postapp/views/asset/v2.pyAdvisories addressed
GHSA-r2hw (critical), GHSA-jh4v (high), GHSA-8688 (high), GHSA-3hrj, GHSA-3892, GHSA-3ggg, GHSA-gcpp, GHSA-p57q, GHSA-c68q, GHSA-8chr, GHSA-58qm, GHSA-wrrw, GHSA-j4mj, GHSA-85h2, GHSA-29q3, GHSA-mwh2, GHSA-xrpv and related duplicates.
Test plan
POST /api/v1/workspaces/{slug}/projects/{projectB_id}/bulk-asset-save/with the asset ID — should return 404PATCH /spaces/{anchor}/assets/{asset_from_other_project}/— should return 404POST /spaces/{anchor}/assets/{id}/restore/with asset from a different project — should return 404GET /api/workspaces/{ws_id}/{asset_key}from a user not in the workspace — should return 404POST /api/v1/workspaces/{slug}/file-assets/withentity_type=WORKSPACE_LOGO— should return 403DuplicateAssetEndpoint: attempt to duplicate an asset from workspace B while calling endpoint in workspace A — should return 404Co-authored-by: Plane AI noreply@plane.so
Summary by CodeRabbit
Release Notes